package com.yp.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.yp.pojo.Job;
import com.yp.service.JobService;

@Controller("searchController")
public class SearchController {
	@Autowired
	private JobService jobService;

	// 进入首页
	@RequestMapping("/want_work/searchthisjob")
	public String search(HttpServletRequest request, Model model) {
		String keyword = (request.getParameter("keyword") == null || "".equals(request.getParameter("keyword").trim()))
				? "大数据" : request.getParameter("keyword");
		List<Job> jobs = jobService.generalQuery(keyword);
		model.addAttribute("jobs", jobs);
		System.err.println(jobs);
		return "/want_work/index";
	}
}
